package com.ruoyi.project.pms.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.pms.mapper.PmsGoodsAttributeMapper;
import com.ruoyi.db.pms.domain.PmsGoodsAttribute;
import com.ruoyi.db.pms.domain.query.PmsGoodsAttributeQueryVo;

/**
 * 商品参数Service业务层处理
 *
 * @author ruoyi
 * @date 2020-04-21
 */
@Service
public class PmsGoodsAttributeService
{
    @Autowired
    private PmsGoodsAttributeMapper pmsGoodsAttributeMapper;

    /**
     * 查询商品参数
     *
     * @param id 商品参数ID
     * @return 商品参数
     */
    public PmsGoodsAttribute selectPmsGoodsAttributeById(Long id)
    {
        return pmsGoodsAttributeMapper.selectPmsGoodsAttributeById(id);
    }

    /**
     * 根据id查询某个商品的所有参数信息
     *
     * @author 张涛
     * @param aid 商品参数ID
     * @return 商品参数
     */
    public List<PmsGoodsAttribute> selectPmsGoodsAllAttributeById(Long aid)
    {
        return (List<PmsGoodsAttribute>) pmsGoodsAttributeMapper.selectPmsGoodsAllAttributeById(aid);
    }

    /**
     * 修改商品参数数组
     *
     * @author 张涛
     * @param list 商品参数
     * @return 结果
     */
    public int updatePmsGoodsAttributeList(List<PmsGoodsAttribute> list)
    {
        return pmsGoodsAttributeMapper.updatePmsGoodsAttributeList(list);
    }

    /**
     * 查询商品参数列表
     *
     * @param pmsGoodsAttributeQueryVo 商品参数
     * @return 商品参数
     */
    public List<PmsGoodsAttribute> selectPmsGoodsAttributeList(PmsGoodsAttributeQueryVo pmsGoodsAttributeQueryVo)
    {
        return pmsGoodsAttributeMapper.selectPmsGoodsAttributeList(pmsGoodsAttributeQueryVo);
    }

    /**
     * 新增商品参数
     *
     * @param pmsGoodsAttribute 商品参数
     * @return 结果
     */
    public int insertPmsGoodsAttribute(PmsGoodsAttribute pmsGoodsAttribute)
    {
        return pmsGoodsAttributeMapper.insertPmsGoodsAttribute(pmsGoodsAttribute);
    }

    /**
     * 修改商品参数
     *
     * @param pmsGoodsAttribute 商品参数
     * @return 结果
     */
    public int updatePmsGoodsAttribute(PmsGoodsAttribute pmsGoodsAttribute)
    {
        pmsGoodsAttribute.setUpdateTime(LocalDateTime.now());
        return pmsGoodsAttributeMapper.updatePmsGoodsAttribute(pmsGoodsAttribute);
    }

    /**
     * 批量删除商品参数
     *
     * @param ids 需要删除的商品参数ID
     * @return 结果
     */
    public int deletePmsGoodsAttributeByIds(Long[] ids)
    {
        return pmsGoodsAttributeMapper.deletePmsGoodsAttributeByIds(ids);
    }

    /**
     * 删除商品参数信息
     *
     * @param id 商品参数ID
     * @return 结果
     */
    public int deletePmsGoodsAttributeById(Long id)
    {
        return pmsGoodsAttributeMapper.deletePmsGoodsAttributeById(id);
    }
}
